<template>
	<view class="content">
		<view class="header">
			<p class="title">质押</p>
			<view class="FIL">
				<view class="FIL_left">
					<p class="text_1">{{wallet.coin_name}}</p>
					<p>总资产：{{wallet.thaw_num}}</p>
				</view>
				<view class="FIL_right">
					<p class="text_2">总可置换算力：{{wallet.thaw_num}}</p>
					<p>总质押（含冻结）：{{wallet.deposit_frozen_num}}</p>
				</view>
			</view>
		</view>
		<view class="core">
			<view class="core_inform">
				<view class="balance">
					<span>质押账户</span>
					<span class="balance_right">{{wallet.deposit_frozen_num}}</span>
				</view>
				<view class="list">
					<view class="list1">
						<p class="text_3">质押数量</p>
						<p>{{wallet.deposit_num}}</p>
					</view>
					<view class="list1">
						<p class="text_3">冻结数量</p>
						<p>{{wallet.frozen_num}}</p>
					</view>
					<view class="list1">
						<p class="text_3">置换算力</p>
						<p>{{wallet.thaw_num}}</p>
					</view>
				</view>
			</view>
		</view>
		<view class="function">
			<view class="function_cen">
				<button @click="setpledge">置换算力</button>
				<button @click="getpledge">质押转出</button>
			</view>
			<p class="text_4">账户明细>></p>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '质押',
				wallet:[],
				id:"",
			}
		},
		onLoad() {
		},
		onShow() {
			this.initData()
			this.getdata()
		},
		methods: {
			//获取Token
			initData(){
				if(this.$db.get('userToken')){
					return
				}else{
					this.$db.userToken()
				}
			},
			setpledge(){
				uni.navigateTo({
					url:'./setpledge?id='+this.id
				})
			},
			getpledge(){
				uni.navigateTo({
					url:'./getpledeg?id='+this.id
				})
			},
			//获取质押数据
			getdata(){
				let data={
					coin_type_ids:''
				}
				this.$api.wallet(data).then(res=>{
					console.log(res)
					this.wallet=res.data.data[0]
					this.id=res.data.data[0].coin_type_id
				}, err => {})
			}
		}
	}
</script>

<style lang="less">
	*{
		margin: 0;
		padding: 0;
		background: #f3f3f3;
		font-family: PingFang SC;
	}
	.content{
		width: 100%;
		height: 1334rpx;
		.header{
			height: 414rpx;
			background: #764CFA;
			opacity: 1;
			text-align: center;
			padding: 0 20rpx;
			.title{
				line-height:200rpx;
				color: #FFFFFC;
				font-size: 36rpx;
				background: #764CFA;
				font-family: PingFang SC;
				font-weight: 400;
			}
			.FIL{
				height: 224rpx;
				background: #FFFFFC;
				opacity: 1;
				border-radius: 8px;
				display: flex;
				justify-content: center;
				padding: 20rpx 24rpx;
				margin-top: 40rpx;
				.FIL_left{
					width: 40%;
					// height: 188rpx;
					background: #FFFFFC;
					border-right: 2px solid #F2F1F5;
					font-size: 28rpx;
					color: #000000;
					p{
						margin-bottom: 24rpx;
						background: #FFFFFC;
						text-align: left;
					}
					.text_1{
						margin-top: 40rpx;
					}
				}
				.FIL_right{
					background: #FFFFFC;
					width: 60%;
					// height: 188rpx;
					font-size: 28rpx;
					color: #000000;
					margin-left: 30rpx;
					p{
						margin-bottom: 24rpx;
						background: #FFFFFC;
						text-align: left;
					}
					.text_2{
						margin-top: 40rpx;
					}
				}
			}
		}
		.core{
			padding:0 20rpx;
			margin-top: 100rpx;
			.core_inform{
				width: 710rpx;
				height: 304rpx;
				background: #FFFFFC;
				opacity: 1;
				border-radius: 8px;
				padding: 40rpx 0;
				.balance{
					background: #FFFFFC;
					padding: 0 40rpx;
					display: flex;
					justify-content:space-between;
					span{
						background: #FFFFFC;
						font-size: 28rpx;
						color: #000000;
					}
				}
				.list{
					background: #FFFFFC;
					display: flex;
					justify-content:space-between;
					padding: 0 46rpx;
					.list1{
						background: #FFFFFC;
						margin-top: 56rpx;
						p{
							background: #FFFFFC;
							font-size: 24rpx;
							color: #000000;
						}
						.text_3{
							color: #666666;
							margin-bottom: 10rpx;
						}
					}
				}
			}
		}
		.function{
			padding:0 20rpx;
			margin-top: 50rpx;
			// border-radius: 8px;
			// background: #FFFFFC;
			.text_4{
				text-align: right;
				color: #999999;
				font-size: 20rpx;
				// background: #FFFFFC;
				border-radius: 8px;
			}
			.function_cen{
				height: 268rpx;
				background: #FFFFFC;
				opacity: 1;
				border-radius: 8px;
				padding: 0 16rpx;
				display: flex;
				justify-content: space-between;
				button{
					width: 290rpx;
					height: 98rpx;
					background: #764CFA;
					opacity: 1;
					border-radius: 4px;
					font-size: 28rpx;
					color: #FFFFFF;
					line-height: 98rpx;
					align-self:center;
				}
			}
		}
	}
</style>
